$$ \newcommand{\floor}[1]{\left\lfloor{#1}\right\rfloor} \newcommand{\ceil}[1]{\left\lceil{#1}\right\rceil} \renewcommand{\mod}{\,\mathrm{mod}\,} \renewcommand{\div}{\,\mathrm{div}\,} \newcommand{\metar}{\,\mathrm{m}} \newcommand{\cm}{\,\mathrm{cm}} \newcommand{\dm}{\,\mathrm{dm}} \newcommand{\litar}{\,\mathrm{l}} \newcommand{\km}{\,\mathrm{km}} \newcommand{\s}{\,\mathrm{s}} \newcommand{\h}{\,\mathrm{h}} \newcommand{\minut}{\,\mathrm{min}} \newcommand{\kmh}{\,\mathrm{\frac{km}{h}}} \newcommand{\ms}{\,\mathrm{\frac{m}{s}}} \newcommand{\mss}{\,\mathrm{\frac{m}{s^2}}} \newcommand{\mmin}{\,\mathrm{\frac{m}{min}}} \newcommand{\smin}{\,\mathrm{\frac{s}{min}}} $$

Prijavi problem


Obeleži sve kategorije koje odgovaraju problemu

Još detalja - opišite nam problem


Uspešno ste prijavili problem!
Status problema i sve dodatne informacije možete pratiti klikom na link.
Nažalost nismo trenutno u mogućnosti da obradimo vaš zahtev.
Molimo vas da pokušate kasnije.

Blocks from the Music Category

The category Music contains blocks which reproduce tones/melodies, the block that serves as a “trigger” for activating the program when a melody is played, as well as the block for storing the values of basic tones and their duration in milliseconds.

Let’s create a program which plays the tone D for 1/4 beat when button A is pressed.

We will have to drag the block onpress from the category Input onto the work surface, and then we insert the block playtone into it.

From the drop-down lists of the given block, we will choose the tone and its duration in milliseconds.

_images/p20.png

Note: Sound is heard through speakers or headphones connected to the computer.

The final look of the code:

_images/p21.png

To test the program, we can run it in the simulator by clicking on the play button.

Task. Create a program, which will play the melody of the song “London Bridge”.

You should use these notes:

  • g, a, g, f, e, f, g

  • d, e, f, e, f, g

  • g, a, g, f, e, f, g

  • d, g, e, c.

You can compare your solution with ours: https://makecode.microbit.org/_LW3UUKAzocbo

If we want to play a melody (a series of notes lasting a certain amount of time, and played one after the other) we use the block playmelody, from the drop-down list of this block we will choose the melody and how long it will last (whether it will be played once, forever, …)

The final look of the code:

_images/p23.png

To test the program, we can run it in the simulator by clicking on the play button.